<?php

/**
 * modulo form base class.
 *
 * @method modulo getObject() Returns the current form's model object
 *
 * @package    sistema_itec_new
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BasemoduloForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'                  => new sfWidgetFormInputHidden(),
      'nombre'              => new sfWidgetFormInputText(),
      'etiqueta'            => new sfWidgetFormInputText(),
      'observaciones'       => new sfWidgetFormInputText(),
      'identificador'       => new sfWidgetFormInputText(),
      'ubicacion_id'        => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Ubicacion'), 'add_empty' => false)),
      'unidad_formacion_id' => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('UnidadFormacion'), 'add_empty' => false)),
      'estado_id'           => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Estado'), 'add_empty' => false)),
      'regimen_id'          => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Regimen'), 'add_empty' => false)),
      'modalidad_id'        => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Modalidad'), 'add_empty' => false)),
    ));

    $this->setValidators(array(
      'id'                  => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)),
      'nombre'              => new sfValidatorString(array('max_length' => 150)),
      'etiqueta'            => new sfValidatorString(array('max_length' => 10, 'required' => false)),
      'observaciones'       => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'identificador'       => new sfValidatorString(array('max_length' => 45, 'required' => false)),
      'ubicacion_id'        => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Ubicacion'))),
      'unidad_formacion_id' => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('UnidadFormacion'))),
      'estado_id'           => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Estado'))),
      'regimen_id'          => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Regimen'))),
      'modalidad_id'        => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Modalidad'))),
    ));

    $this->widgetSchema->setNameFormat('modulo[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'modulo';
  }

}
